<template>
  <div>
    <router-view></router-view>
    <van-tabbar v-model="active" route>
      <van-tabbar-item to="/home/brand" icon="shop-o">品牌分类</van-tabbar-item>
      <van-tabbar-item to="/home/training" icon="gift-o">训练工具</van-tabbar-item>
      <van-tabbar-item to="/home/accessories" icon="cart-o">配套产品</van-tabbar-item>
      <van-tabbar-item to="/home/cart" icon="shopping-cart-o">
        购物车
        <template #badge>
          <van-badge :content="cartStore.totalCount" v-if="cartStore.totalCount > 0" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/home/orders" icon="orders-o">订单管理</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useCartStore } from '../stores/cart.js'

const active = ref(0)
const cartStore = useCartStore()
</script>

<style scoped>
.home-container {
  background-color: #f7f8fa;
  padding-bottom: 50px;
}
</style> 